library("MESS")
library("emmeans")
library("dplyr")
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library("magrittr")
library("tidyr")
## 
## Attaching package: 'tidyr'
## The following object is masked from 'package:magrittr':
## 
##     extract
library("ggplot2")
library("readxl")
library("ggthemes")
library("stringr")
library("purrr")
## 
## Attaching package: 'purrr'
## The following object is masked from 'package:magrittr':
## 
##     set_names
library("dr4pl")
library("readr")

1. Data import & organization

Load required metadata which is a file with the strain ID, the well position and the taxonomic assignment and eventual further information of the strain.

Strain Well Replicate Plate Phylum Class Order Family Genus Well_Plate
BIS-30 D2 1 Plate_A PhylumD ClassD OrderC FamilyB GenusB D2_Plate_A
BIS-30 D6 2 Plate_A PhylumD ClassD OrderC FamilyB GenusB D6_Plate_A
BIS-30 D10 3 Plate_A PhylumD ClassD OrderC FamilyB GenusB D10_Plate_A
BIS-16 B3 1 Plate_A PhylumA ClassE OrderE FamilyC GenusC B3_Plate_A
BIS-16 B7 2 Plate_A PhylumA ClassE OrderE FamilyC GenusC B7_Plate_A
BIS-16 B11 3 Plate_A PhylumA ClassE OrderE FamilyC GenusC B11_Plate_A

Load the raw data from the measurements directly as excel files. Since the data series of each plate are saved in a separate workbook, we load the workbooks using a loop and combine them using a treatment label per plate (defined in labellist). Be careful to assign the correct plate to the correct treatment according to their order in the stack. More parameters can be defined in this list such as the medium used, the plate, the run and the chemical.

Provide a labellist for plate information, treatments are spread accross sheets in the table to be read. The first column contains the information on the number, the second for the treatment, the third for the concentration of the chemical, the fourth the chemical compound, the fifth the media, the sixth the preculture plate and the seventh the run.

Number Treat Concentration Compound Media Plate Run
1 Dummy NULL NULL NULL NULL R1
2 Ctrl_DMSO_TSB_A 0_uM DMSO TSB Plate_A R1
3 250_uM_COMP_TSB_A 250_uM COMP TSB Plate_A R1
4 500_uM_COMP_TSB_A 500_uM COMP TSB Plate_A R1
5 625_uM_COMP_TSB_A 625_uM COMP TSB Plate_A R1
6 1250_uM_COMP_TSB_A 1250_uM COMP TSB Plate_A R1

Creates time intervals form the time of the measurements.

2. Density delta

Calculate the density delta by subtracting the density at the first measurement from the measurements at the following time points.

Plot maximal density to check if all strains grew in the control treatment.

Remove strains which grow bad in the control manually (Density_max < 0.25 in Conc = 0)

results %<>% filter(!Strain %in% "BIS-6")

3. Growth curves

Check contamination in the control plate only containing medium (“media_control_plate”).

4. Area under the curve

To quantify the total bacterial growth over time, we calculate the total area under the curve (AUC). This is done with the function “auc()”. To comparison between treatments, the total AUC (AUC_raw) is normalized by the AUC of the strain grown in the control treatment (no chemicals added, just normal growth media with DMSO). The normalized values are used for all further analysis, plotting and calculations.

remove strains with poor growth in the control treatment.

Below, first we plot AUC values of all strains in all concentrations to get an insight in the overall growth of the strains. Then we plot the AUC_norm values to explore the relative growth reduction in the different concentrations of the chemical compared to the control treatment.

AUC normalised to control.

5. Tolerance index

To compare the tolerance among different bacterial strains, we use the tolerance index (TI). The tolerance index is calculated from the area under the curve of the AUC of each strain in the different concentrations of the compounds, as further normalization the tolindex_norm is calculated from AUC_norm instead of AUC. Accordingly, a strain with TI_norm = 1 is completely tolerant to the compound in each concentration (not inhibited by the compound). Tolerance index is calculated for each compound separately using results_AUC from the respective compound.

6. Dose response

sessionInfo()
## R version 4.3.3 (2024-02-29)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Sonoma 14.5
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## time zone: Europe/Zurich
## tzcode source: internal
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] readr_2.1.5    dr4pl_2.0.0    purrr_1.0.2    stringr_1.5.1  ggthemes_5.1.0
##  [6] readxl_1.4.3   ggplot2_3.5.1  tidyr_1.3.1    magrittr_2.0.3 dplyr_1.1.4   
## [11] emmeans_1.10.1 MESS_0.5.12   
## 
## loaded via a namespace (and not attached):
##  [1] beeswarm_0.4.0     gtable_0.3.5       xfun_0.43          bslib_0.7.0       
##  [5] rstatix_0.7.2      lattice_0.22-6     tzdb_0.4.0         vctrs_0.6.5       
##  [9] tools_4.3.3        Rdpack_2.6         generics_0.1.3     sandwich_3.1-0    
## [13] tibble_3.2.1       fansi_1.0.6        highr_0.10         pkgconfig_2.0.3   
## [17] Matrix_1.6-5       ggridges_0.5.6     rematch_2.0.0      lifecycle_1.0.4   
## [21] farver_2.1.1       compiler_4.3.3     munsell_0.5.1      codetools_0.2-20  
## [25] carData_3.0-5      vipor_0.4.7        htmltools_0.5.8.1  sass_0.4.9        
## [29] yaml_2.3.8         car_3.1-2          ggpubr_0.6.0       pillar_1.9.0      
## [33] jquerylib_0.1.4    MASS_7.3-60.0.1    cachem_1.0.8       abind_1.4-5       
## [37] multcomp_1.4-25    mosaicCore_0.9.4.0 tidyselect_1.2.1   digest_0.6.35     
## [41] mvtnorm_1.2-4      stringi_1.8.4      labeling_0.4.3     forcats_1.0.0     
## [45] geepack_1.3.10     splines_4.3.3      labelled_2.13.0    fastmap_1.1.1     
## [49] grid_4.3.3         colorspace_2.1-0   cli_3.6.2          survival_3.6-4    
## [53] utf8_1.2.4         geeM_0.10.1        broom_1.0.5        TH.data_1.1-2     
## [57] ggformula_0.12.0   clipr_0.8.0        withr_3.0.0        tensor_1.5        
## [61] scales_1.3.0       backports_1.4.1    ggbeeswarm_0.7.2   estimability_1.5.1
## [65] rmarkdown_2.26     ggsignif_0.6.4     cellranger_1.1.0   zoo_1.8-12        
## [69] hms_1.1.3          coda_0.19-4.1      evaluate_0.23      knitr_1.45        
## [73] haven_2.5.4        rbibutils_2.2.16   rlang_1.1.3        Rcpp_1.0.12       
## [77] xtable_1.8-4       glue_1.7.0         rstudioapi_0.16.0  jsonlite_1.8.8    
## [81] R6_2.5.1